﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using YNTK.Common.Filter;
using YNTK.Dependency;

namespace YNTK.System.Entitys.Dto.Permission.User
{
    /// <summary>
    /// 查询用户请求模型
    /// </summary>
    [SuppressSniffer]
    public class QueryTkUsersFilterRequestModel: PageBaseRequestModel
    {
        /// <summary>
        ///组织id
        /// </summary>
        public string organizeId { get; set; }

        /// <summary>
        /// 机构id
        /// </summary>
        public string mechanismId { get; set; }

        /// <summary>
        /// 角色id
        /// </summary>
        public string roleId { get; set; }

        /// <summary>
        /// 启用/禁用,1.启用 0.禁用 2.全部
        /// </summary>
        public int? enabledMark { get; set; }

        /// <summary>
        /// 用户类型
        /// </summary>
        public int? accountType { get; set; } = null;

        /// <summary>
        /// 模糊查询,用户名、姓名、身份证号、手机号、邮箱
        /// </summary>
        /// <example></example>
        public string keyword { get; set; }

        /// <summary>
        /// 是否只查询没有角色的用户,角色管理分配用户专用传true
        /// </summary>
        public bool noRole { get; set; } = false;
    }

    /// <summary>
    /// 用户数据传输模型
    /// </summary>
    [SuppressSniffer]
    public class TkUserListDto
    {
        /// <summary>
        /// 用户id
        /// </summary>
        public string id { get; set; }

        /// <summary>
        ///组织id
        /// </summary>
        public string organizeId { get; set; }

        /// <summary>
        ///组织名称
        /// </summary>
        public string organizeName { get; set; }

        /// <summary>
        /// 机构id
        /// </summary>
        public string mechanismId { get; set; }

        /// <summary>
        /// 机构名称
        /// </summary>
        public string mechanismName { get; set; }

        /// <summary>
        /// 角色id
        /// </summary>
        public string roleId { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>
        public string roleName { get; set; }

        /// <summary>
        /// 账号类型(0.平台运营人员 1.超级管理员 2.组织管理员 3.组织用户 4.第三方登录用户 5.游客用户)
        /// </summary>
        public int accountType { get; set; }

        /// <summary>
        /// 账号类型文本
        /// </summary>
        public string accountTypeText { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string account { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        public string realName { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        public string certificatesNumber { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        public string mobilePhone { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string email { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string description { get; set; }

        /// <summary>
        /// 排序码
        /// </summary>
        public long? sortCode { get; set; }

        /// <summary>
        /// 启用/禁用,1.启用
        /// </summary>
        public int? enabledMark { get; set; }     
    }

    /// <summary>
    /// 用户信息传输模型
    /// </summary>
    [SuppressSniffer]
    public class TkUserInfoDto: TkUserListDto
    {
        /// <summary>
        /// 用户id,前端不用
        /// </summary>
        public string userId { get; set; }

        /// <summary>
        /// 是否超级管理员,前端不用
        /// </summary>
        public bool isAdministrator { get; set; }

        /// <summary>
        /// 角色主键,前端不用
        /// </summary>
        public string[] roleIds { get; set; }

        /// <summary>
        /// 下属机构,前端不用
        /// </summary>
        public string[] subsidiary { get; set; }

        /// <summary>
        /// 我的下属,前端不用
        /// </summary>
        public string[] subordinates { get; set; }

        /// <summary>
        /// 登录id地址,前端不用
        /// </summary>
        public string iPAddress { get; set; }

        /// <summary>
        /// 平台设备,前端不用
        /// </summary>
        public string platForm { get; set; }

        /// <summary>
        /// 组织log存储路径
        /// </summary>
        public string logId { get; set; }

        /// <summary>
        /// 组织授权tk码
        /// </summary>
        public string authorizationCode { get; set; }

        /// <summary>
        /// 是否为第三方用户,非运营平台为均禁用为否
        /// </summary>
        public bool thirdParty { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        public string headIcon { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public int? gender { get; set; }

        /// <summary>
        /// 性别文本
        /// </summary>
        public string genderText { get; set; }

        /// <summary>
        /// 出生日期
        /// </summary>
        public DateTime? birthday { get; set; }

        /// <summary>
        /// 民族
        /// </summary>
        public string nation { get; set; }

        /// <summary>
        /// 籍贯
        /// </summary>
        public string nativePlace { get; set; }

        /// <summary>
        /// 入职日期
        /// </summary>
        public DateTime? entryDate { get; set; }
    }

    /// <summary>
    /// 用户下拉数据传输模型
    /// </summary>
    [SuppressSniffer]
    public class TkUserSelectListDto
    {
        /// <summary>
        /// 用户id
        /// </summary>
        public string id { get; set; }

        /// <summary>
        /// 是否为第三方用户
        /// </summary>
        public bool thirdParty { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        public string realName { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        public string certificatesNumber { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        public string mobilePhone { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string email { get; set; }
    }

    /// <summary>
    /// 添加用户请求模型
    /// </summary>
    [SuppressSniffer]
    public class AddUserRequestModel
    {
        /// <summary>
        ///组织id,运营平台创建平台角色传00000000
        /// </summary>
        public string organizeId { get; set; }

        /// <summary>
        /// 机构id
        /// </summary>
        public string mechanismId { get; set; }

        /// <summary>
        /// 角色id
        /// </summary>
        public string roleId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [Required(ErrorMessage = "用户名不能为空")]
        public string account { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
         [Required(ErrorMessage = "姓名不能为空")]
        public string realName { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        public string certificatesNumber { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        public string mobilePhone { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string email { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string description { get; set; }

        /// <summary>
        /// 排序码
        /// </summary>
        public long? sortCode { get; set; }

        /// <summary>
        /// 启用/禁用,1.启用
        /// </summary>
        public int? enabledMark { get; set; }

        /// <summary>
        /// 是否为第三方用户,非运营平台为均禁用为否
        /// </summary>
        public bool thirdParty { get; set; } = false;

    }

    /// <summary>
    /// 修改用户请求模型
    /// </summary>
    [SuppressSniffer]
    public class UpdateUserRequestModel: AddUserRequestModel
    {
        /// <summary>
        /// 用户id
        /// </summary>
        [Required(ErrorMessage = "用户唯一标识不能为空")]
        public string id { get; set; }
    }

    /// <summary>
    /// 角色管理分配用户专用模型
    /// </summary>
    [SuppressSniffer]
    public class RoleDistributionUserRequestModel
    {
        /// <summary>
        /// 角色id
        /// </summary>
        [Required(ErrorMessage = "角色唯一标识不能为空")]
        public string id { get; set; }

        /// <summary>
        /// 用户id集合
        /// </summary>
        [Required(ErrorMessage = "请至少选择一个用户")]
        public List<string> userIds { get; set; }
    }

    /// <summary>
    /// 用户管理分配角色请求模型
    /// </summary>
    [SuppressSniffer]
    public class TkUserAuthorizationRequestModel
    {
        /// <summary>
        /// 用户id
        /// </summary>
        [Required(ErrorMessage = "用户唯一标识不能为空")]
        public string id { get; set; }

        /// <summary>
        /// 角色id
        /// </summary>
        [Required(ErrorMessage = "角色唯一标识不能为空")]
        public string roleId { get; set; }
    }

    /// <summary>
    /// 用户重置密码请求模型
    /// </summary>
    [SuppressSniffer]
    public class ResetPasswordRequestModel
    {
        /// <summary>
        /// 用户id
        /// </summary>
        [Required(ErrorMessage = "用户唯一标识不能为空")]
        public string id { get; set; }

        /// <summary>
        /// 原密码
        /// </summary>
        [Required(ErrorMessage = "原密码不能为空")]
        public string oldPassword { get; set; }

        /// <summary>
        /// 新密码
        /// </summary>
        [Required(ErrorMessage = "新密码不能为空")]
        [RegularExpression("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$",
            ErrorMessage = "密码必须至少包含八个字符、至少包含一个数字、小写和大写的字母以及特殊字符")]
        public string newPassword { get; set; }
    }

    /// <summary>
    /// 用户设置系统主题请求模型
    /// </summary>
    [SuppressSniffer]
    public class SetThemeRequestModel
    {
        /// <summary>
        /// 系统语言
        /// </summary>
        public string language { get; set; }

        /// <summary>
        /// 系统主题
        /// </summary>
        public string theme { get; set; }

        /// <summary>
        /// 导航背景色
        /// </summary>
        public string backgroundColor { get; set; }

        /// <summary>
        /// 导航文本色
        /// </summary>
        public string navigationTextColor { get; set; }
    }

    /// <summary>
    /// 用户系统主题信息传输模型
    /// </summary>
    [SuppressSniffer]
    public class ThemeDto: SetThemeRequestModel
    {

    }

}
